function save_reservation() {//保存预约
    var customerPhone = document.getElementById("customerPhone").innerHTML;
    var fieldTc = document.getElementById("fieldTc").value;
    var doctor = document.getElementById("doctor").value;
    var remarks = document.getElementById("remarks").value;
    var reservationsId = document.getElementById("reservationsId").value;
    var customerId = document.getElementById("customerId").value;
    var treatmentUnit = document.getElementById("treatmentUnit").value;
    var projectData = document.getElementById("appointmentPayService").value;
    var startTime = document.getElementById("startTime").value;
    var duration = document.getElementById("duration").value;
    var scordd = document.getElementById("scordd").value;
    if (startTime == "" || startTime == null) {
        alert("请选择时间！");
        return
    }
    if (duration == "" || duration == null) {
        alert("请选择持续时间！");
        return
    }
    if (treatmentUnit == "" || treatmentUnit == null) {
        alert("请选择科室！");
        return
    }
    var weekEnd = startTime.split(" ")[0] + " 20:00:00";
    if (startTime > weekEnd) {
        alert("预约时间不在医生工作时间内！");
        return
    }
    if (scordd == "sc") {
        $.ajax({
            url: Feng.ctxPath + "/customer/addCustomerMarket",
            type: "post",
            data: {
                "reservationsId": reservationsId,
                "startTimeValue": startTime,
                "customerPhone": customerPhone,
                "customerId": customerId,
                "projectData": projectData,
                "treatmentUnit": treatmentUnit,
                "fieldTc": fieldTc,
                "doctor": doctor,
                "remarks": remarks,
                "duration": duration
            },
            success: function (data) {
                Feng.success('预约成功!');
                window.location.href = Feng.ctxPath + "/receptionPatientsCentral/appointment_index";
            },
            error: function (data) {
                Feng.success('预约失败!')
            }
        })
    } else {
        $.ajax({
            url: Feng.ctxPath + "/customer/addCustomerFzs",
            type: "post",
            data: {
                "reservationsId": reservationsId,
                "startTimeValue": startTime,
                "customerPhone": customerPhone,
                "customerId": customerId,
                "projectData": projectData,
                "treatmentUnit": treatmentUnit,
                "fieldTc": fieldTc,
                "doctor": doctor,
                "remarks": remarks,
                "duration": duration,
                "isFz": "2"
            },
            success: function (data) {
                var ids=data.ids;
                if(data.status==1){
                    window.parent.register(data);
                }
                if (ids == 11) {
                    alert('预约时间必须大于当前时间!')
                } else {
                    Feng.success('预约成功!');
                    window.location.href = Feng.ctxPath + "/receptionPatientsCentral/appointment_index";
                }
            },
            error: function (data) {
                Feng.success('预约失败!')
            }
        })
    }
}

function patient_backHome () { //点击返回跳转页面 - 首页
    window.location.href = Feng.ctxPath + "/receptionPatientsCentral/appointment_index";
}

function select_patients() { //点击选择患者
    window.location.href = Feng.ctxPath + "/receptionPatientsCentral/appointment_selectPatients";
}